using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Fungus;
using Unity.VisualScripting;

public class 亭子对话 : MonoBehaviour
{
    
    public GameObject tips;
    public string Chatname;
   public bool cantalk = false;
    // Start is called before the first frame update
    void Start()
    {
       
    }

    // Update is called once per frame
    void Update()
    {
        
        
    }
    private void OnTriggerStay(Collider other)
    {
        Cursor.lockState = CursorLockMode.Confined;
        Flowchart flowchart = GameObject.Find("Flowchart").GetComponent<Flowchart>();
        tips.SetActive(true);
        cantalk = true;
        
        if (cantalk==true)
        {
            if (Input.GetKeyDown(KeyCode.F))
            {
                flowchart.ExecuteBlock(Chatname);
                cantalk = false;
            }
        }
       
    }
    private void OnTriggerExit(Collider other)
    {
        tips.SetActive(false);
        cantalk =false;
        Cursor.lockState = CursorLockMode.Locked;
    }
}
